#include "WriteBuffer.h"

namespace frame {
namespace imp {

void WriteBuffer::pushBack(const std::string & str){
    data.emplace_back(str);
}
void WriteBuffer::pushBack(std::string && str){
    data.emplace_back(std::move(str));
}
void WriteBuffer::pushBack(const char * cstr){
    data.emplace_back(cstr);
}
void WriteBuffer::pushBack(const char * buf, size_t len){
    data.emplace_back(buf, len);
}
void WriteBuffer::popBack(){
    data.pop_back();
}
const std::string & WriteBuffer::front() const{
    return data.front();
}
const std::string & WriteBuffer::back() const{
    return data.back();
}
void WriteBuffer::clear(){
    data.clear();
}

std::ostream & operator<<(std::ostream & os, const WriteBuffer & wb){
    os << "len:" << wb.size();
    for(auto & w : wb){
        os << w;
    }
    return os;
}

} //end of namespace imp
} //end of namespace  frame
